#include "head.h"

int initPthreads(status_t *status,int num){
    (status->q).front = 0;
    (status->q).rear = 0;
    (status->q).size = 0;
    (status->q).capacity = 10;
    (*status).q.fd = (int *)malloc((status->q).capacity*sizeof(int));
    
    pthread_mutex_init(&status->lock,NULL);
    pthread_cond_init(&status->cond,NULL);

    status->end_flag = 0;
    status->pthreads = (pthread_t *)malloc(num*sizeof(pthread_t));
    for(int i = 0 ; i < num ; i++){
        pthread_create(&status->pthreads[i],NULL,func,status);
    }
    return 0;
}

